import json
from os.path import join, abspath
from typing import List
from backend.experiment.framework.implement import PromptPerplexityImplement


class RawTextPerplexityImplement(PromptPerplexityImplement):
    @classmethod
    def get_test_sample_prompt(cls) -> List[str]:
        with open(join(cls.data_dir(), 'text.json'), 'r', encoding='utf8') \
                as file:
            records = json.loads(file.read())
        return records

    @classmethod
    def data_dir(cls) -> str:
        return abspath(join(__file__, '../'))

    @classmethod
    def cache_dir(cls) -> str:
        return join(cls.work_dir(), 'cache')

    @classmethod
    def work_dir(cls) -> str:
        return abspath(join(__file__, '..'))
